home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Informant Complete 1995 - 2000
/
Delphi Informant Complete 1995 to 2000.iso
/
Delphi Informant Magazine Complete Works SOURCE CODE 1998.rar
/
1998
/
Sep
/
di9809cd
/
WinPerf.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1997-12-12
|
27KB
|
532 lines
unit WinPerf;
interface
uses Windows;
const
PERF_DATA_VERSION = 1;
PERF_DATA_REVISION = 1;
// In order for data to be returned through the Configuration Registry
// in a system-independent fashion, it must be self-describing.
// In the following, all offsets are in bytes.
//
// Data is returned through the Configuration Registry in a
// a data block which begins with a _PERF_DATA_BLOCK structure.
//
type
PPerf_Data_Block = ^TPerf_Data_Block;
TPerf_Data_Block = packed record
Signature : Array [0..3] of WideChar; // Signature: Unicode "PERF"
LittleEndian : DWORD; // 0 = Big Endian, 1 = Little Endian
Version : DWORD; // Version of these data structures
Revision : DWORD; // Revision of these data structures
TotalByteLength : DWORD; // Total length of data block
HeaderLength : DWORD; // Length of this structure
NumObjectTypes : DWORD; // Number of types of objects being reported
DefaultObject : LongInt; // Object Title Index of default
// object to display when data from
// this system is retrieved (-1 =
// none, but this is not expected to
// be used)
SystemTime : TSYSTEMTIME; // Time at the system under measurement
PerfTime : TLARGEINTEGER; // Performance counter value
// at the system under measurement
PerfFreq : TLARGEINTEGER; // Performance counter frequency
// at the system under measurement
PerfTime100nSec : TLARGEINTEGER; // Performance counter time in 100 nsec
// units at the system under measurement
SystemNameLength : DWORD; // Length of the system name
SystemNameOffset : DWORD; // Offset, from beginning of this
// structure, to name of system
// being measured
end;
//
// The _PERF_DATA_BLOCK structure is followed by NumObjectTypes of
// data sections, one for each type of object measured. Each object
// type section begins with a _PERF_OBJECT_TYPE structure.
//
PPerf_Object_Type = ^TPerf_Object_Type;
TPerf_Object_Type = packed record
TotalByteLength : DWORD; // Length of this object definition
// including this structure, the
// counter definitions, and the
// instance definitions and the
// counter blocks for each instance:
// This is the offset from this
// structure to the next object, if
// any
DefinitionLength : DWORD; // Length of object definition,
// which includes this structure
// and the counter definition
// structures for this object: this
// is the offset of the first
// instance or of the counters
// for this object if there is
// no instance
HeaderLength : DWORD; // Length of this structure: this
// is the offset to the first
// counter definition for this
// object
ObjectNameTitleIndex : DWORD; // Index to name in Title Database
ObjectNameTitle : PWideChar; // Initially NULL, for use by
// analysis program to point to
// retrieved title string
ObjectHelpTitleIndex : DWORD; // Index to Help in Title Database
ObjectHelpTitle : PWideChar; // Initially NULL, for use by
// analysis program to point to
// retrieved title string
DetailLevel : DWORD; // Object level of detail (for
// controlling display complexity);
// will be min of detail levels
// for all this object's counters
NumCounters : DWORD; // Number of counters in each
// counter block (one counter
// block per instance)
DefaultCounter : LongInt; // Default counter to display when
// this object is selected, index
// starting at 0 (-1 = none, but
// this is not expected to be used)
NumInstances : LongInt; // Number of object instances
// for which counters are being
// returned from the system under
// measurement. If the object defined
// will never have any instance data
// structures (PERF_INSTANCE_DEFINITION)
// then this value should be -1, if the
// object can have 0 or more instances,
// but has none present, then this
// should be 0, otherwise this field
// contains the number of instances of
// this counter.
CodePage : DWORD; // 0 if instance strings are in
// UNICODE, else the Code Page of
// the instance names
PerfTime : TLARGEINTEGER; // Sample Time in "Object" units
PerfFreq : TLARGEINTEGER; // Frequency of "Object" units in
// counts per second.
end;
const
PERF_NO_INSTANCES = -1; // no instances (see NumInstances above)
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//
// PERF_COUNTER_DEFINITION.CounterType field values
//
//
// Counter ID Field Definition:
//
// 3 2 2 2 2 1 1 1
// 1 8 4 2 0 6 2 0 8 0
// +--------+--------+----+----+--------+--------+----+----+----------------+
// |Display |Calculation |Time|Counter | |Ctr |Size| |
// |Flags |Modifiers |Base|SubType |Reserved|Type|Fld | Reserved |
// +--------+--------+----+----+--------+--------+----+----+----------------+
//
//
// The counter type is the "or" of the following values as described below
//
// select one of the following to indicate the counter's data size
//
PERF_SIZE_DWORD = $00000000;
PERF_SIZE_LARGE = $00000100;
PERF_SIZE_ZERO = $00000200; // for Zero Length fields
PERF_SIZE_VARIABLE_LEN = $00000300; // length is in CounterLength field
// of Counter Definition struct
//
// select one of the following values to indicate the counter field usage
//
PERF_TYPE_NUMBER = $00000000; // a number (not a counter)
PERF_TYPE_COUNTER = $00000400; // an increasing numeric value
PERF_TYPE_TEXT = $00000800; // a text field
PERF_TYPE_ZERO = $00000C00; // displays a zero
//
// If the PERF_TYPE_NUMBER field was selected, then select one of the
// following to describe the Number
//
PERF_NUMBER_HEX = $00000000; // display as HEX value
PERF_NUMBER_DECIMAL = $00010000; // display as a decimal integer
PERF_NUMBER_DEC_1000 = $00020000; // display as a decimal/1000
//
// If the PERF_TYPE_COUNTER value was selected then select one of the
// following to indicate the type of counter
//
PERF_COUNTER_VALUE = $00000000; // display counter value